home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 248 / 248.d81 / t.db+ doc 5 < prev    next >
Text File  |  2022-08-26  |  11KB  |  443 lines

  1. u
  2.             DOTBASIC PLUS
  3.                 Part V
  4.      by Dave Moorman & Lee Novak
  5.  
  6.  
  7.   EXTENDING DB+
  8.   -------------
  9.  
  10.     We have added four major ML
  11. Modules to DB+ which use memory from
  12. page 128 through 207. You don't have
  13. to worry much about memory management,
  14. because the area is safely placed
  15. above the Top of Basic. However, you
  16. may want to know how things are laid
  17. out.
  18.  
  19.   Page     Contents
  20.   ----   ------------
  21.   128    !BMP Color !
  22.   129    !          !
  23.   130    !          !
  24.   131    !..........!
  25.   132    !Sprites   !
  26.   133    !..........!
  27.   134    !Grafstar  !
  28.   135    !          !
  29.   136    !          !
  30.    %     %,',',',','%
  31.   143    !          !
  32.   144    !          !
  33.   145    !..........!
  34.   146    !MUS File  !
  35.    %     %,',',',','%
  36.   151    !          !
  37.   152    !..........!
  38.   153    !Scriptor  !
  39.   154    !          !
  40.   155    !..........!
  41.   156    !BMP Multi-!
  42.   157    !Color Data!
  43.   158    !          !
  44.   159    !..........!
  45.   160    !BitMapData!
  46.    %     %,',',',','%
  47.   191    !..........!
  48.   192    !SIDPlayer !
  49.    %     %,',',',','%
  50.   204    !..........!
  51.   205    !BitMap    !
  52.   206    !Load/Unpak!
  53.   207    !..........!
  54.  
  55.      If you are not using .BMP,
  56. .GRAF, or .SCRIPT, then everything
  57. from 144-159 is available for Music
  58. files, and pages 160-191 are available
  59. for data, such as directories and
  60. text. Now you know more than you
  61. really needed.
  62.  
  63.  
  64.   BITMAP
  65.   ------
  66.     Include .BMP
  67.   .BMP,FILE$,DV,160,128,156
  68.   .BMPSCR,SWITCH
  69.     SWITCH  1 = Display Bitmap
  70.             0 = Display Text Screen
  71.  
  72.     When you include .BMP in your
  73. program, .BMP and .BMPSCR are added to
  74. your Command list. Also, an auxillary
  75. file bload is added to your boot
  76. program so that DBA.UNP.ML is copied
  77. to your work disk and loaded into
  78. memory -- using pages 205-207. Also,
  79. the Top of BASIC is lowered from page
  80. 160 to 128, to make room for the
  81. bitmap, which uses 128-132, 160-191,
  82. and 156-159 for display.
  83.  
  84.     In your program, use .BMP to load
  85. and unpack a LOADSTAR SHP graphic
  86. file, using the values listed above.
  87. The arrow sprite is automatically
  88. copied to page 132 and switched over
  89. by .BMP.
  90.  
  91.   100 .BMP,"GRAPHIC.SHP",D,160,128,156
  92.   110 .BMPSCR,1
  93.   120 .DO:.MA:.UN L2%
  94.   130 .BMPSCR,0
  95.  
  96.     Your mouse arrow will not even
  97. flicker! Oh, you don't want the arrow
  98. on the graphic? Add POKE 53269,0 to
  99. line 110 and POKE 53269,3 to line 130.
  100.  
  101.  
  102.   SIDPLAYER
  103.   ---------
  104.      Include: .SID
  105.   .SID,LOCATION
  106.   .SIDOFF
  107.  
  108.     DB+ will play SIDSongs! When you
  109. include .SID in your program, .SID and
  110. .SIDOFF are added to your Command
  111. List. Also, an auxillary file bload is
  112. added to your boot program so that
  113. DBA.SID.ML is loaded into memory --
  114. using pages 192-204. Also, the Top of
  115. BASIC is lowered from page 160 to 144
  116. (unless .BMP is used), to make room
  117. for the MUS file(s) at 144-154 (with
  118. .BMP) or 144-159 (without .BMP).
  119.  
  120.   100 .BL,"MUSIC1.MUS",D,144*256
  121.   110 .SID,144*256
  122.   120 .DO:.MA:.UN L2%
  123.   130 .SIDOFF
  124.  
  125.  
  126.   GRAFSTAR
  127.   --------
  128.     Include: .GRAF
  129.   .GRAF
  130.   .GMODE,MODE#
  131.   .GPEN,P0,P1,P2,P3
  132.   .GPLOT,X,Y,PEN
  133.   .GLINE,X,Y,PEN
  134.   .GP,X,Y
  135.   .GCLIP,X1,X2,Y1,Y2
  136.   .GOFFSET,XOFF,YOFF
  137.   .GYREV,DIR
  138.   .GFILL,X,Y,PEN
  139.  
  140.     The world of bitmap graphics from
  141. DotBASIC Plus is made possible by a
  142. module Dave Moorman wrote years ago --
  143. Grafstar. As you can gather from the
  144. commands listed above, we have a lot
  145. of power here! When you include .GRAF
  146. in your program, all the other
  147. commands listed above are added to
  148. your Command List. Also, an auxillary
  149. file bload is added to your boot
  150. program so that DBA.GRA.ML is loaded
  151. into memory -- using pages 134-145.
  152. You can use the Grafstar commands
  153. along with .BMP commands.
  154.  
  155.     .GRAF -- This MUST be the first
  156. command of the Grafstar commands
  157. used. This initializes the location
  158. for the Bitmap -- Bitmap at page 160,
  159. color at page 128, just like with the
  160. .BMP command.
  161.  
  162.     .GMODE,MODE# -- Sets the type of
  163. screen that is being displayed.
  164.  
  165.        0   Default Text Screen
  166.        1   High Res Bitmap
  167.        2   Text Screen -- Multi-Color
  168.        3   Multi-Color Bitmap
  169.      * 4   Show Text, Clear High Res
  170.      * 5   High Res Bitmap, Cleared
  171.      * 6   Show Text, Clear Multi-C
  172.      * 7   Multi-Color Bitmap, Cleared
  173.  
  174.      * Modes 4 - 7 put 0's in all
  175. bitmap locations.  Modes 4 and 5 also
  176. put current colors for pens 0 and 1
  177. into the color map.
  178.  
  179.     If you are using .GRAF commands
  180. with .BMP, use .BMP,f$,d,160,128,156
  181. to load the SHP graphic, then --
  182. rather than .BMPSCR -- use .GMODE,1
  183. (hi res) or .GMODE,3 (multi-color) to
  184. switch to the bitmap, and .GMODE,0 to
  185. return to the text screen. (.BMPSCR
  186. has a toggling effect that gets
  187. cumbersome.)
  188.  
  189.     .GPEN,P0,P1,P2,P3 -- This sets the
  190. colors of the four "pens" used with
  191. .GPLOT .GLINE and .GFILL. The four
  192. background color registers are used
  193. for this, so P0 will change the
  194. background of your text screen (use
  195. .BG,color to reset the background of
  196. the text screen after .GMODE,0).
  197.  
  198.     .GPLOT,X,Y,PEN -- Plots a pixel at
  199. pixel X/Y in the color set for the PEN
  200. number. X/Y values off the screen are
  201. OK, just not visible.
  202.  
  203.     .GLINE,X,Y,PEN -- Draws a line
  204. from the previous .GPLOT or the last
  205. point of the previous .GLINE.
  206.  
  207.     .GP,X,Y -- Returns the pen number
  208. of the pixel at X/Y in P%. If X/Y is
  209. not visible, P% will hold 128.
  210.  
  211.     .GCLIP,X1,X2,Y1,Y2 -- GrafStar
  212. uses dynamic clipping to avoid trying
  213. to plot a point that is out of bounds.
  214. Before calculating the actual memory
  215. and bit location, the coordinates are
  216. checked against the clip parameters.
  217. If not visible, GrafStar avoids some
  218. useless drudgery! But the upshot is
  219. that you can set the clip parameters
  220. with this command. With .GCLIP, you
  221. can keep your graphics within a window
  222. area.
  223.  
  224.     Note that you must add 1 to the
  225. RIGHT and BOTTOM values. Or to put it
  226. another way, LEFT and TOP is the first
  227. point to be plotted while RIGHT and
  228. BOTTOM is the first point to be
  229. clipped. Clip values MUST be within
  230. the following range:
  231.  
  232.     LEFT   --  0 - 319 (High Res)
  233.     LEFT   --  0 - 159 (Multi-Color)
  234.     RIGHT  --  1 - 320 (High Res)
  235.     RIGHT  --  1 - 160 (Multi-Color)
  236.     TOP    --  0 - 199
  237.     BOTTOM --  1 - 200
  238.  
  239.     Also, RIGHT must be greater than
  240. LEFT and BOTTOM greater than TOP.
  241. GrafStar checks and produces an
  242. ILLEGAL VALUE ERROR when something is
  243. wrong.
  244.  
  245.     .GOFFSET,XOFF,YOFF -- Lets you
  246. place the coordinates 0,0 ANYWHERE on
  247. the screen. Negative coordinates are
  248. visible.
  249.  
  250.    XOFF -- number of pixels that the
  251. X coordinate 0 will be pushed to the
  252. right.
  253.  
  254.    YOFF -- number of pixels that the
  255. Y coordinate 0 will be pushed down.
  256.  
  257.    XOFF and YOFF must be legal screen
  258. coordinates:
  259.  
  260.       XOFF -- 0 - 319 (High Res)
  261.       XOFF -- 0 - 159 (Multi-Color)
  262.       YOFF -- 0 - 199
  263.  
  264.     With OFFSET, you can define
  265. polygons as a series of vertices, in
  266. all four quadrants, and position the
  267. polygon with the OFFSET command. To
  268. center the plotting of a polynomial,
  269. set the OFFSET to the middle of the
  270. screen:
  271.  
  272.    .GOFFSET, 160, 100
  273.  
  274.    Just think of the possibilities!
  275.  
  276.     .GYREV,DIR -- DIR indicates which
  277. way a plot moves when the Y coordinate
  278. is increased:
  279.  
  280.     DIR
  281.      0    Normal -- moving down screen
  282.      1    Reverse -- moving up screen
  283.  
  284.     My son, the mathematician,
  285. complained that the C-64 designers got
  286. it all wrong. Positive Y coordinates
  287. should move UP along the X axis, not
  288. down! Or to put it another way: Don't
  289. you just hate having to do a 199-Y to
  290. get the graph to appear right side up?
  291. .GYREV does it all for you. For
  292. instance, to create a true
  293. mathematical plot with 0,0 at the
  294. center of the screen:
  295.  
  296.    .GOFFSET, 160, 100 :rem Offset
  297.    .GYREV, 1          :rem Y is UP!
  298.  
  299.     .GFILL,X,Y,PEN -- Someday, I will
  300. learn NOT to call Fender before a
  301. project is finished <grin>. He always
  302. has one more idea to include in a
  303. program! In this case, it was a fill
  304. command. The parameters are identical
  305. to PLOT, LINE, and POINT, and are
  306. adjusted in the same way for OFFSET an
  307. Y-REVERSE. FILL will take the pen
  308. value at the coordinates given,
  309. consider it "empty," and replace every
  310. contigenous instance with the PEN#
  311. given in the command, stopping at the
  312. occurance of any location that is "not
  313. empty."
  314.  
  315.      You will note that GrafStar's
  316. FILL is reasonably fast. This is
  317. because if an entire byte of bitmap
  318. memory is "empty," the byte is filled
  319. at on